<?php
/**
 * CakePOWER
 * Plugins Extension Manager
 * 
 * @author:			Marco Pegoraro
 * @mail:			marco(dot)pegoraro(at)gmail(dot)com
 * 
 * 24 September 2009
 * This file try to load extensions rules for the plugins.
 * 
 */

/**
 * Plugins Extends.
 */
foreach ( DAC::read('sys.plugin') as $pluginName=>$plugin ) {
	
	DAC::write( 'tmp.pluginPath', DAC::read('sys.plugin.'.$pluginName.'.path') );
			
	// Compose the extends.php path and try to load it into system.                       #
	$tmp = DAC::read('sys.plugin.'.$pluginName.'.path').'config'.DS.'extends.php';
	if ( file_exists($tmp) ) require_once($tmp);
	
	// Compose the extension class name to check and run.                                 #
	$tmp = $pluginName.'ExtensionManager';
	if ( class_exists($tmp) ) ExtensionManager::addConfigureClass( new $tmp );
	
	DAC::delete( 'tmp.pluginPath' );
	
}

/**
 * Clean local variables.
 */
unset( $plugin );
unset( $pluginName );
?>